<!-- 维修管理 -->
<template>
  <div class="app-container">
    <!-- 表格状态切换按钮 -->
    <ul class="nav">
      <li v-for="v in navData" :class="{ active: v.value == queryParams.orderStatus }" @click="navChangeHandle(v.value)">
        {{ v.label }}
      </li>
    </ul>

    <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
      <searchType v-for="v in searchProps" :data="v" :selects="sel_option[v.prop]" v-model="queryParams[v.prop]"
        :handleQuery="handleQuery">
      </searchType>
      <el-form-item>
        <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
        <el-button icon="Refresh" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button type="primary" plain icon="Plus" @click="handleAdd"
          v-hasPermi="['gwc:repairManagement:add']">申请</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="warning" plain icon="Download" @click="handleExport"
          v-hasPermi="['gwc:repairManagement:export']">导出</el-button>
      </el-col>
      <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="managementList" @selection-change="handleSelectionChange">
      <!-- <el-table-column type="selection" width="55" align="center" /> -->
      <el-table-column :label="v.label" align="center" :prop="v.prop" :width="v.width" v-for="v in tableProps"
        show-overflow-tooltip>
        <template #default="scope">
          <dict-tag v-if="v.prop == 'orderStatus'" :options="sel_option.repairTableOrderStatus"
            :value="scope.row[v.prop]" />
          <dict-tag v-else-if="v.prop == 'repairReason'" :options="sel_option[v.prop]" :value="scope.row[v.prop]" />
          <span v-else>{{ scope.row[v.prop] }}</span>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="220" fixed="right">
        <template #default="scope">
          <el-button link type="primary" @click="submitOrder(scope.row, 0)" v-show="scope.row.orderStatus == '5'"
            v-hasPermi="['gwc:repairManagement:edit']">提交</el-button>
          <el-button link type="primary" @click="submitOrder(scope.row, 2)" v-show="scope.row.orderStatus == '1'"
            v-hasPermi="['gwc:repairManagement:edit']">已送修</el-button>
          <el-button link type="primary" @click="repairSuccess(scope.row)" v-show="scope.row.orderStatus == '2'"
            v-hasPermi="['gwc:repairManagement:edit']">维修完成</el-button>
          <el-button link type="primary" @click="successHandleDetail(scope.row)" v-show="scope.row.orderStatus == '3'"
            v-hasPermi="['gwc:repairManagement:edit']">完成详情</el-button>
          <el-button link type="primary" @click="handleDetail(scope.row)" v-show="scope.row.orderStatus != '3'"
            v-hasPermi="['gwc:repairManagement:edit']">详情</el-button>
          <el-button link type="primary" @click="handleUpdate(scope.row)" v-if="queryParams.orderStatus == '045'"
            v-hasPermi="['gwc:repairManagement:edit']">编辑</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize"
      @pagination="getList" />

    <!-- 添加或修改维修管理对话框 -->
    <el-dialog :title="title" v-model="open" width="800px" append-to-body :destroy-on-close="true" class="sky-form">
      <el-form ref="managementRef" :model="form" :rules="rules" label-width="110px" :disabled="formDisabled">
        <el-form-item v-for="v in editParams" :key="v.prop" :label="v.label" :prop="v.prop" :class="v.type">
          <template v-if="v.prop == 'repairCompany'">
            <el-input v-model="form[v.prop]" type="textarea" :rows="1" style="width: calc(100% - 24px);" />
            <el-icon style="cursor: pointer; margin-left: auto; font-size: 16px;" @click="showLocationMap"
              v-show="!formDisabled">
              <Location />
            </el-icon>
          </template>
          <el-input v-else-if="v.type == 'input'" v-model.trim="form[v.prop]"></el-input>
          <el-select v-else-if="v.type == 'select'" v-model="form[v.prop]" filterable clearable>
            <el-option v-for="item in sel_option[v.prop]" :key="item.value" :label="item.label" :value="item.value">
            </el-option>
          </el-select>
          <el-tree-select v-else-if="v.type == 'treeSelect'" v-model="form[v.prop]" clearable :data="sel_option[v.prop]"
            :expand-on-click-node="false" :render-after-expand="false" check-strictly :props="{ label: 'label' }"
            node-key="id" filterable placeholder="" />
          <ImageUpload :limit="6" :rank="0" ref="fileUpload" url='/gwc/repairManagement/uploadRepair'
            :pictures='form[v.prop] || []' v-else-if="v.type == 'photo'" :disabled="formDisabled">
          </ImageUpload>
          <el-date-picker v-else-if="v.type == 'datePicker'" v-model="form[v.prop]" type="datetime"
            :disabled-date="disabledDate" value-format="YYYY-MM-DD HH:mm:ss" />
          <destination v-else-if="v.type == 'destination'" v-model="form[v.prop]" :disabled="formDisabled">
          </destination>
          <el-select v-model="form[v.prop]" filterable remote reserve-keyword placeholder="请输入光伏板编号查询"
            :remote-method="remoteMethod" :loading="remoteLoading" v-else-if="v.type == 'carSelect'">
            <el-option v-for="item in sel_option[v.prop]" :key="item.id" :label="item.numberPlate" :value="item.id" />
          </el-select>
          <el-select v-model="form[v.prop]" filterable remote reserve-keyword placeholder="请输入负责人查询"
            :remote-method="remoteDriverMethod" :loading="remoteDriverLoading" v-else-if="v.type == 'driverSelect'">
            <el-option v-for="item in sel_option[v.prop]" :key="item.id" :label="item.name" :value="item.id" />
          </el-select>
          <el-input v-else-if="v.type == 'textarea'" v-model="form[v.prop]" type="textarea" :rows="1" />
        </el-form-item>
      </el-form>
      <template #footer>
        <div class="dialog-footer" v-show="!formDisabled">
          <el-button type="primary" @click="submitForm">确 定</el-button>
          <el-button @click="cancel">取 消</el-button>
        </div>
      </template>
    </el-dialog>

    <!-- 维修完成对话框 -->
    <el-dialog title="维修完成" v-model="repairOpen" width="800px" append-to-body :destroy-on-close="true" class="sky-form">
      <el-form ref="repairRef" :model="form" :rules="rules" label-width="110px" :disabled="formDisabled">
        <el-form-item v-for="v in repairEditParams" :key="v.prop" :label="v.label" :prop="v.prop" :class="v.type">
          <template v-if="v.prop == 'repairCompany'">
            <el-input v-model="form[v.prop]" type="textarea" :rows="1" style="width: calc(100% - 24px);" />
            <el-icon style="cursor: pointer; margin-left: auto; font-size: 16px;" @click="showLocationMap"
              v-show="!formDisabled">
              <Location />
            </el-icon>
          </template>
          <el-input v-else-if="v.type == 'input'" v-model.trim="form[v.prop]"></el-input>
          <el-select v-else-if="v.type == 'select'" v-model="form[v.prop]" filterable clearable>
            <el-option v-for="item in sel_option[v.prop]" :key="item.value" :label="item.label" :value="item.value">
            </el-option>
          </el-select>
          <el-tree-select v-else-if="v.type == 'treeSelect'" v-model="form[v.prop]" clearable :data="sel_option[v.prop]"
            :expand-on-click-node="false" :render-after-expand="false" check-strictly :props="{ label: 'label' }"
            node-key="id" filterable placeholder="" />
          <ImageUpload :limit="6" :rank="0" ref="fileUpload" url='/gwc/repairManagement/uploadRepair'
            :pictures='form[v.prop] || []' v-else-if="v.type == 'photo'" :disabled="formDisabled">
          </ImageUpload>
          <el-date-picker v-else-if="v.type == 'datePicker'" v-model="form[v.prop]" type="datetime"
            :disabled-date="disabledDate" value-format="YYYY-MM-DD HH:mm:ss" />
          <destination v-else-if="v.type == 'destination'" v-model="form[v.prop]" :disabled="formDisabled">
          </destination>
          <el-select v-model="form[v.prop]" filterable remote reserve-keyword placeholder="请输入光伏板编号查询"
            :remote-method="remoteMethod" :loading="remoteLoading" v-else-if="v.type == 'carSelect'">
            <el-option v-for="item in sel_option[v.prop]" :key="item.id" :label="item.numberPlate" :value="item.id" />
          </el-select>
          <el-select v-model="form[v.prop]" filterable remote reserve-keyword placeholder="请输入负责人查询"
            :remote-method="remoteDriverMethod" :loading="remoteDriverLoading" v-else-if="v.type == 'driverSelect'">
            <el-option v-for="item in sel_option[v.prop]" :key="item.id" :label="item.name" :value="item.id" />
          </el-select>
          <el-input v-else-if="v.type == 'textarea'" v-model="form[v.prop]" type="textarea" :rows="1" />
        </el-form-item>
      </el-form>
      <template #footer>
        <div class="dialog-footer" v-show="!formDisabled">
          <el-button type="primary" @click="repairSubmitForm">确 定</el-button>
          <el-button @click="cancel">取 消</el-button>
        </div>
      </template>
    </el-dialog>

    <!-- 维修完成查看 -->
    <el-dialog title="完成查看" v-model="successOpen" width="800px" append-to-body :destroy-on-close="true" class="sky-form">
      <el-form ref="repairRef" :model="form" :rules="rules" label-width="110px" :disabled="formDisabled">
        <el-form-item v-for="v in successEditParams" :key="v.prop" :label="v.label" :prop="v.prop" :class="v.type">
          <template v-if="v.prop == 'repairCompany'">
            <el-input v-model="form[v.prop]" type="textarea" :rows="1" style="width: calc(100% - 24px);" />
            <el-icon style="cursor: pointer; margin-left: auto; font-size: 16px;" @click="showLocationMap"
              v-show="!formDisabled">
              <Location />
            </el-icon>
          </template>
          <el-input v-else-if="v.type == 'input'" v-model.trim="form[v.prop]"></el-input>
          <el-select v-else-if="v.type == 'select'" v-model="form[v.prop]" filterable clearable>
            <el-option v-for="item in sel_option[v.prop]" :key="item.value" :label="item.label" :value="item.value">
            </el-option>
          </el-select>
          <el-tree-select v-else-if="v.type == 'treeSelect'" v-model="form[v.prop]" clearable :data="sel_option[v.prop]"
            :expand-on-click-node="false" :render-after-expand="false" check-strictly :props="{ label: 'label' }"
            node-key="id" filterable placeholder="" />
          <ImageUpload :limit="6" :rank="0" ref="fileUpload" url='/gwc/repairManagement/uploadRepair'
            :pictures='form[v.prop] || []' v-else-if="v.type == 'photo'" :disabled="formDisabled">
          </ImageUpload>
          <el-date-picker v-else-if="v.type == 'datePicker'" v-model="form[v.prop]" type="datetime"
            :disabled-date="disabledDate" value-format="YYYY-MM-DD HH:mm:ss" />
          <destination v-else-if="v.type == 'destination'" v-model="form[v.prop]" :disabled="formDisabled">
          </destination>
          <el-select v-model="form[v.prop]" filterable remote reserve-keyword placeholder="请输入光伏板编号查询"
            :remote-method="remoteMethod" :loading="remoteLoading" v-else-if="v.type == 'carSelect'">
            <el-option v-for="item in sel_option[v.prop]" :key="item.id" :label="item.numberPlate" :value="item.id" />
          </el-select>
          <el-select v-model="form[v.prop]" filterable remote reserve-keyword placeholder="请输入负责人查询"
            :remote-method="remoteDriverMethod" :loading="remoteDriverLoading" v-else-if="v.type == 'driverSelect'">
            <el-option v-for="item in sel_option[v.prop]" :key="item.id" :label="item.name" :value="item.id" />
          </el-select>
          <el-input v-else-if="v.type == 'textarea'" v-model="form[v.prop]" type="textarea" :rows="1" />
        </el-form-item>
      </el-form>
      <template #footer>
        <div class="dialog-footer" v-show="!formDisabled">
          <el-button type="primary" @click="repairSubmitForm">确 定</el-button>
          <el-button @click="cancel">取 消</el-button>
        </div>
      </template>
    </el-dialog>

    <el-dialog title="地址选择" v-model="locationOpen" width="800px" append-to-body :destroy-on-close="true">
      <div style="height: 600px;">
        <LocationSet ref="myEditMap" v-model="form.pointsWgs84"></LocationSet>
      </div>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="primary" @click="setFormLocation">确 定</el-button>
        </div>
      </template>
    </el-dialog>
  </div>
</template>

<script setup name="RepairManagement" lang="ts">
import { searchComponentType } from "@/components/tableRelate/searchTypeTs"
import { listManagement, getManagement, delManagement, addManagement, updateManagement } from "@/api/gwc/repairManagement";
import { getSearchCompanyListRole } from "@/api/system/dept";
import dayjs from "dayjs"
const { proxy } = getCurrentInstance() as any;

const managementList = ref([]);
const open = ref(false);
const repairOpen = ref(false);
const successOpen = ref(false);
const locationOpen = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const title = ref("");
const formDisabled = ref(false);
//订单状态（0:已申请，1：已审批，2：已送修，3：已完成，4：已撤销 5：已驳回）
const navData = reactive([
  { label: "维修申请", value: "045" }, //订单状态（0:已申请,4：已撤销 5：已驳回）
  { label: "待审批", value: "0" },
  { label: "待送修", value: "1" },
  { label: "待完成", value: "2" },
  { label: "已完成", value: "3" },
])

const data = reactive({
  form: {},
  queryParams: {
    pageNum: 1,
    pageSize: 15,
    companyId: null,
    driverId: null,
    vehicleId: null,
    repairCompany: null,
    pointsWgs84: null,
    orderRepair: null,
    repairrReason: null,
    repairCostStr: null,
    repairRepairStr: null,
    expectCostStr: null,
    repairTime: null,
    brandModel: null,
    orderStatus: "045",
    imageList: null,
    remarks: null,
  },
  rules: {
    companyId: [
      { required: true, message: "所属作业公司不能为空", trigger: "blur" }
    ],
  }
});

const tableProps = ref([
  { label: "订单状态", prop: "orderStatus", width: "120", type: 'dict' },
  { label: "所属部门", prop: "companyName", width: "120" },
  { label: "负责人姓名", prop: "driverName", width: "120", },
  { label: "光伏板编号", prop: "numberPlate", width: "120" },
  { label: "申请人电话", prop: "contactNumber", width: "120" },
  { label: "委托维修单位", prop: "repairCompany", width: "120" },
  { label: "预约维修项目", prop: "orderRepair", width: "120", type: "dict" },
  { label: "维修原因", prop: "repairReason", width: "120", type: "dict" },
  { label: "维修费用(元)", prop: "repairCostStr", width: "120" },
  { label: "送修里程(km)", prop: "repairRepairStr", width: "120" },
  { label: "预计费用(元)", prop: "expectCostStr", width: "120" },
  { label: "送修时间", prop: "repairTime", width: "180" },
  { label: "厂牌型号", prop: "brandModel", width: "120" },
  { label: "备注说明", prop: "remark", width: "120" },
])
const editParams = reactive([
  { label: "所属部门", prop: "companyId", type: "treeSelect" },
  { label: "光伏板编号", prop: "vehicleId", type: "carSelect" },
  { label: "负责人姓名", prop: "driverId", type: "driverSelect", },
  { label: "送修里程(km)", prop: "repairRepairStr", type: "input" },
  { label: "送修时间", prop: "repairTime", type: "datePicker" },
  { label: "厂牌型号", prop: "brandModel", type: "input" },
  { label: "委托维修单位", prop: "repairCompany", type: "textarea", required: true },
  { label: "预约维修项目", prop: "orderRepair", type: "textarea" },
  { label: "维修原因", prop: "repairReason", type: "select" },
  { label: "预计费用(元)", prop: "expectCostStr", type: "input" },
  { label: "备注说明", prop: "remark", type: "textarea" },
  { label: "申请凭证", prop: "imageList", type: "photo" },
])
const repairEditParams = reactive([
  { label: "维修费用(元)", prop: "repairCostStr", type: "input" },
  { label: "维修凭证", prop: "imageRepair", type: "photo" },
])
const successEditParams = reactive([
  { label: "所属部门", prop: "companyId", type: "treeSelect" },
  { label: "光伏板编号", prop: "vehicleId", type: "carSelect" },
  { label: "负责人姓名", prop: "driverId", type: "driverSelect", },
  { label: "送修里程(km)", prop: "repairRepairStr", type: "input" },
  { label: "送修时间", prop: "repairTime", type: "datePicker" },
  { label: "厂牌型号", prop: "brandModel", type: "input" },
  { label: "委托维修单位", prop: "repairCompany", type: "textarea", required: true },
  { label: "预约维修项目", prop: "orderRepair", type: "textarea" },
  { label: "维修原因", prop: "repairReason", type: "select" },
  { label: "预计费用(元)", prop: "expectCostStr", type: "input" },
  { label: "备注说明", prop: "remark", type: "textarea" },
  { label: "申请凭证", prop: "imageList", type: "photo" },
  { label: "维修费用(元)", prop: "repairCostStr", type: "input" },
  { label: "维修凭证", prop: "imageRepair", type: "photo" },
])
const disabledDate = (time: Date) => {
  const oneDay = 24 * 60 * 60 * 1000; // 一天的毫秒数
  const today = new Date();
  const yesterday = new Date(today.getTime() - oneDay);
  return time.getTime() <= yesterday.getTime()
}
const searchProps = ref([
  { label: "所属部门", prop: "companyId", type: searchComponentType.treeSelect },
  { label: "光伏板编号", prop: "vehicleId", type: searchComponentType.input },
  { label: "委托维修单位", prop: "createTime", type: searchComponentType.dateTime },
  { label: "送修人", prop: "createTime", type: searchComponentType.dateTime },
])

const { queryParams, form, rules } = toRefs(data) as any;
const sel_option = ref<any>({});
let dictList = tableProps.value.filter(v => v.type == 'dict').map(v => v.prop);
sel_option.value = proxy.useDict.apply(this, [...dictList, 'repairTableOrderStatus']);
const treeList = ref([])
getSearchCompanyListRole().then(res => {
  treeList.value = res.data
  sel_option.value.companyId = res.data
});
function navChangeHandle(val) {
  queryParams.value.orderStatus = val;
  handleQuery();
}
proxy.setValidateByTable(rules, editParams);

import { getVehicleList, getDriverList } from "@/api/tool/gen"
const remoteLoading = ref(true);
const remoteDriverLoading = ref(true);
const remoteMethod = (queryStr: string) => {
  remoteLoading.value = true
  if (queryStr) {
    getVehicleList({
      pageNum: 1,
      pageSize: 10,
      companyId: form.value.companyId, //公司id
      numberPlate: queryStr, //光伏板编号（支持模糊匹配）
    }).then((res: any) => {
      remoteLoading.value = false;
      sel_option.value.vehicleId = res.rows
    })
  }
}

const remoteDriverMethod = (queryStr: string) => {
  remoteDriverLoading.value = true
  if (queryStr) {
    getDriverList({
      pageNum: 1,
      pageSize: 10,
      companyId: form.value.companyId, //公司id
      name: queryStr,
    }).then((res: any) => {
      remoteDriverLoading.value = false;
      sel_option.value.driverId = res.rows;
    })
  }
}

function showLocationMap() {
  locationOpen.value = true
}

function setFormLocation() {
  form.value.repairCompany = form.value.pointsWgs84.address
  form.value.pointsWgs84 = [{
    lng: form.value.pointsWgs84.lng,
    lat: form.value.pointsWgs84.lat,
  }]
  locationOpen.value = false
}

/** 查询维修管理列表 */
function getList() {
  loading.value = true;
  listManagement(queryParams.value).then((response: any) => {
    managementList.value = response.rows;
    total.value = response.total;
    loading.value = false;
  });
}

// 取消按钮
function cancel() {
  open.value = false;
  repairOpen.value = false;
  reset();
}

// 表单重置
function reset() {
  form.value = {
    repairId: null,
    companyId: null,
    driverId: null,
    vehicleId: null,
    repairCompany: null,
    pointsWgs84: null,
    orderRepair: null,
    repairrReason: null,
    repairCostStr: null,
    repairRepairStr: null,
    expectCostStr: null,
    repairTime: null,
    brandModel: null,
    orderStatus: null,
    imageList: null,
    remarks: null,
    createTime: null,
    updateTime: null,
    updateBy: null,
    createBy: null
  };
  proxy.resetForm("managementRef");
}

/** 搜索按钮操作 */
function handleQuery() {
  queryParams.value.pageNum = 1;
  getList();
}

/** 重置按钮操作 */
function resetQuery() {
  proxy.resetForm("queryRef");
  handleQuery();
}

// 多选框选中数据
function handleSelectionChange(selection) {
  ids.value = selection.map(item => item.repairId);
  single.value = selection.length != 1;
  multiple.value = !selection.length;
}

/** 新增按钮操作 */
function handleAdd() {
  reset();
  open.value = true;
  formDisabled.value = false;
  title.value = "添加维修管理";
}

// 维修完成
function repairSuccess(row) {
  reset();
  form.value = row;
  formDisabled.value = false;
  repairOpen.value = true;
}

/** 修改按钮操作 */
function handleUpdate(row) {
  reset();
  formDisabled.value = false;
  form.value = row;
  open.value = true;
  title.value = "修改维修管理";
  sel_option.value.vehicleId = [
    {
      id: row.vehicleId,
      numberPlate: row.numberPlate,
    }
  ]
  sel_option.value.driverId = [
    {
      id: row.driverId,
      name: row.driverName,
    }
  ]
}

/** 提交为待审批 */
function submitOrder(row, orderStatus) {
  const newData = JSON.parse(JSON.stringify(row))
  newData.orderStatus = orderStatus;
  updateManagement(newData).then(response => {
    proxy.$modal.msgSuccess("提交成功");
    cancel();
    getList();
  });
}

/** 详情按钮操作 */
function handleDetail(row) {
  reset();
  form.value = row;
  open.value = true;
  formDisabled.value = true;
  title.value = "查看维修管理";
  sel_option.value.vehicleId = [
    {
      id: row.vehicleId,
      numberPlate: row.numberPlate,
    }
  ]
  sel_option.value.driverId = [
    {
      id: row.driverId,
      name: row.driverName,
    }
  ]
}

/** 完成详情按钮操作 */
function successHandleDetail(row) {
  reset();
  form.value = row;
  successOpen.value = true;
  formDisabled.value = true;
  sel_option.value.vehicleId = [
    {
      id: row.vehicleId,
      numberPlate: row.numberPlate,
    }
  ]
  sel_option.value.driverId = [
    {
      id: row.driverId,
      name: row.driverName,
    }
  ]
}

/** 提交按钮 */
function submitForm() {
  proxy.$refs["managementRef"].validate(async valid => {
    if (valid) {
      let fileList = await proxy.$refs["fileUpload"][0].uploadInfo();
      if (fileList) form.value.imageList = JSON.parse(JSON.stringify(fileList));
      if (form.value.repairId != null) {
        updateManagement(form.value).then(response => {
          proxy.$modal.msgSuccess("修改成功");
          cancel();
          getList();
        });
      } else {
        addManagement(form.value).then(response => {
          proxy.$modal.msgSuccess("新增成功");
          cancel();
          getList();
        });
      }
    }
  });
}

/** 维修完成提交按钮 */
function repairSubmitForm() {
  proxy.$refs["repairRef"].validate(async valid => {
    if (valid) {
      let fileList = await proxy.$refs["fileUpload"][0].uploadInfo();
      if (fileList) form.value.imageRepair = JSON.parse(JSON.stringify(fileList));
      form.value.orderStatus = 3;
      if (form.value.repairId != null) {
        updateManagement(form.value).then(response => {
          proxy.$modal.msgSuccess("修改成功");
          cancel();
          getList();
        });
      } else {
        addManagement(form.value).then(response => {
          proxy.$modal.msgSuccess("新增成功");
          cancel();
          getList();
        });
      }
    }
  });
}

/** 删除按钮操作 */
function handleDelete(row) {
  const _repairIds = row.repairId || ids.value;
  proxy.$modal.confirm('是否确认删除维修管理编号为"' + _repairIds + '"的数据项？').then(function () {
    return delManagement(_repairIds);
  }).then(() => {
    getList();
    proxy.$modal.msgSuccess("删除成功");
  }).catch(() => { });
}

/** 导出按钮操作 */
function handleExport() {
  proxy.download('gwc/repairManagement/export', {
    ...queryParams.value
  }, `维修管理_${dayjs(new Date()).format("YYYY-MM-DD_HH:mm:ss")}.xlsx`)
}

getList();
</script>
<style scoped lang="scss">
.textarea,
.destination,
.photo {
  display: block-flex !important;
  display: flex !important;
  width: calc(100% - 64px)
}

.disableClass {
  :deep(.item-actions) {
    opacity: 0 !important;
  }
}
</style>